package com.wing.qualityTesting.dao;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wing.productionPlan.model.entity.ProAbnormalCause;
import com.wing.qualityTesting.model.entity.QualityTestingRecord;
import com.wing.qualityTesting.model.response.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * 质检记录表-Dao
 *
 * @author
 */
@Mapper
public interface QualityTestingRecordDao extends BaseMapper<QualityTestingRecord> {

    /**
     * 列表-app
     *
     * @param params
     *
     * @return
     */
    List<QualityTestingRecordVO> list4app(@Param("params") Map<String, Object> params);

    /**
     * 分页列表-app
     *
     * @param page
     * @param params
     *
     * @return
     */
    List<QualityTestingRecordVO> list4app(@Param("page") Page<QualityTestingRecordVO> page, @Param("params") Map<String, Object> params);

    /**
     * 详情-app
     *
     * @param id
     *
     * @return
     */
    QualityTestingRecordVO get4appById(Long id);

    WorkOrderQualityTestingTaskVO getTestingTaskByTaskId(@Param("taskId") Long taskId);

    /**
     * 查询任务的基本信息
     * @param taskId
     * @return
     */
    QualityTaskDetailRecordVo getTaskDetailRecord(@Param("taskId") Long taskId);

    /**
     * 查询时间线
     * @param taskId
     * @return
     */
    QualityTimeDetailInfoVo getTimeInfo(@Param("taskId") Long taskId);

    /**
     * 查询订单完成后 最后一个的处理信息
     * @param recordId
     * @return
     */
    QualityTimeDetailInfoVo selectLastDetailFinshInfo(@Param("recordId") Long recordId);

    /**
     * 查询新的记录明细列表
     * @param pg
     * @param paramMap
     * @return
     */
    List<QualityTestingRecordDetailSearchVO> pageList4appNew(@Param("page") Page<QualityTestingRecordDetailSearchVO> pg, @Param("params") Map paramMap);

    /**
     * 查询一物一检未检测数量
     * @param id
     * @return
     */
    int getNotCheckQuatityBy(@Param("id") Long id);

    /**
     * 根据开工单关联的排产工序 查询基关联基准书工序上绑定的原始工序的 质检异常信息
     * @param processId
     * @return
     */
    List<ProAbnormalCause> getAbnormalCauseBy(@Param("processId") Long processId);
}
